#include "tansu_internal.h"
#include "tansu_nwif.h"

int main()
{
    tansu_status_t status;
    struct tansu_nwif *nwif;
    struct tansu_nwifs *head = tansu_nwif_getaddrs(&status);

    if (head == NULL) {
        printf("tansu_nwif_getaddrs() failed %d\n", status);
        return -1;
    }

    STAILQ_FOREACH(nwif, head, entry) {
        printf("================================\n");
        printf("name   : %s\n", nwif->name);
        printf("family : %s\n", nwif->family == AF_INET ? "IPv4" : "IPv6");
        printf("addr   : %s\n", nwif->addr);
        printf("mask   : %s\n", nwif->netmask);
        unsigned char *mac = nwif->hwaddr;
        printf("mac    : %02x:%02x:%02x:%02x:%02x:%02x\n",
               mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    }

    tansu_nwif_freeaddrs(head);

    return 0;
}

